#include "../PGE2D/PGE2D.h"

using namespace PGE2D;

Camera *camera;
Mesh *mesh;

bool PGE2D::game_preload()
{
	g_engine->setAppTitle( "CUBE DEMO" );
	g_engine->setScreenHeight( 768 );
	g_engine->setScreenWidth( 1024 );
	g_engine->setColorDepth( 32 );
	return true;
}

bool PGE2D::game_init( HWND hWnd )
{
	mesh = new Mesh();
	mesh->CreateCube( 2.0f, 2.0f, 2.0f );

	camera = new Camera();
	camera->setPosition( 0.0f, 2.0f, 6.0f );
	camera->setTarget( 0.0f, 0.0f, 0.0f );
	camera->Update();

	g_engine->SetAmbient( D3DCOLOR_XRGB( 40, 40, 255 ) );

	return true;
}

void PGE2D::game_update()
{

}

void PGE2D::game_end()
{
	delete camera;
	delete mesh;
}

void PGE2D::game_render3d()
{
	g_engine->ClearScene( D3DCOLOR_RGBA( 30, 30, 100, 0 ) );
	g_engine->SetIdentity();

	mesh->Rotate( 2.0f, 0.0f, 0.0f );
	mesh->Transform();
	mesh->Draw();
}